]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
tests/background-size: Remove ClutterActor::paint signal handler usage
authorJonas Dreßler <verdre@v0yd.nl>
Fri, 23 Oct 2020 20:05:13 +0000 (22:05 +0200)
committerJonas Dreßler <verdre@v0yd.nl>
Sat, 24 Oct 2020 21:21:39 +0000 (23:21 +0200)
The background-size interactive test includes a test-case which uses the
ClutterActor::paint signal to hijack the painting of the actor. We're
removing that signal from Clutter, so remove that signal handler and
paint the outer border unconditionally to mark the boundaries of the
widget (the outer border actually never worked to force the cairo/cogl
path). To fix the test, change it to not paint a border on the inner
container in the useCairo=false case, which should make sure the cogl
path gets used.

Also remove the useless useCairo argument from addTestLine().

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1479

tests/interactive/background-size.js

index 064bc9e868d856ae56e186f743778340d1abc98d..8f8738da917d2ac202f7578c2c3908832eb756e0 100644 (file)
@@ -27,49 +27,16 @@ function test() {
     let tbox = null;
 
     function addTestCase(image, size, backgroundSize, useCairo) {
-        // Using a border in CSS forces cairo rendering.
-        // To get a border using cogl, we paint a border using
-        // paint signal hacks.
-
-        let obin = new St.Bin();
-        if (useCairo)
-            obin.style = 'border: 3px solid green;';
-        else
-            obin.connect_after('paint', (actor, paintContext) => {
-                let framebuffer = paintContext.get_framebuffer();
-                let coglContext = framebuffer.get_context();
-
-                let pipeline = new Cogl.Pipeline(coglContext);
-                pipeline.set_color4f(0, 1, 0, 1);
-
-                let alloc = actor.get_allocation_box();
-                let width = 3;
-
-                // clockwise order
-                framebuffer.draw_rectangle(pipeline,
-                                           0, 0, alloc.get_width(), width);
-                framebuffer.draw_rectangle(pipeline,
-                                           alloc.get_width() - width, width,
-                                           alloc.get_width(), alloc.get_height());
-                framebuffer.draw_rectangle(pipeline,
-                                           0,
-                                           alloc.get_height(),
-                                           alloc.get_width() - width,
-                                           alloc.get_height() - width);
-                framebuffer.draw_rectangle(pipeline,
-                                           0,
-                                           alloc.get_height() - width,
-                                           width,
-                                           width);
-            });
+        let obin = new St.Bin({ style: 'border: 3px solid green;' });
         tbox.add(obin);
 
         let [width, height] = size;
         let bin = new St.Bin({ style_class: 'background-image-' + image,
                                width: width,
                                height: height,
-                               style: 'border: 1px solid transparent;'
-                               + 'background-size: ' + backgroundSize + ';',
+                               style: `${useCairo
+                                   ? 'border: 1px solid transparent;' : ''
+                               } background-size: ${backgroundSize};`,
                                x_fill: true,
                                y_fill: true
                              });
@@ -81,7 +48,7 @@ function test() {
                                    }));
     }
 
-    function addTestLine(image, size, useCairo) {
+    function addTestLine(image, size) {
         const backgroundSizes = ["auto", "contain", "cover", "200px 200px", "100px 100px", "100px 200px"];
 
         let [width, height] = size;